﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace CashOrCard.Repository
{
    public interface IBaseRepository<T> where T : class,new()
    {
        bool AddEntities(T entity);

        bool UpdateEntities(T entity);

        bool DeleteEntities(T entity);

        T AddEntity(T entity);

        IQueryable<T> LoadEntities(Func<T, bool> wherelambda);

        //Pagenation
        IQueryable<T> LoadPagerEntities<S>(int pageSize, int pageIndex, out int total, Func<T, bool> whereLambda,
                                           bool isAsc, Func<T, S> orderByLambda);

        IQueryable<T> Where(Expression<Func<T, bool>> predicate);

        T Get(int id);

        bool Save();

        void Delete(T o);
    }
}